package com.Smart.smartscals.CustomView;

import com.Smart.smartscals.Activity.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class CustomSexchoiceView extends LinearLayout implements
		OnClickListener {

	private View mView;
	private Context mContext;
	private ImageView imgFemal, imgMals;
	private int statue;

	public CustomSexchoiceView(Context context, AttributeSet attrs) {
		super(context, attrs);
		mContext = context;
		initView();
		setListener();

	}

	private void setListener() {
		imgFemal.setOnClickListener(this);
		imgMals.setOnClickListener(this);
	}

	private void initView() {

		mView = ((LayoutInflater) mContext
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(
				R.layout.customview_choicesex, this);
		imgFemal = (ImageView) mView
				.findViewById(R.id.img_guide_sexchoice_femal);
		imgMals = (ImageView) mView.findViewById(R.id.img_guide_sexchoice_meal);

	}

	public void startMyTration() {

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.img_guide_sexchoice_femal:
			doFemalJob();

			break;
		case R.id.img_guide_sexchoice_meal:
			doMalJob();
			break;

		default:
			break;
		}

	}

	/*
	 * 男
	 */
	private void doMalJob() {
		imgMals.setAlpha((float) 1);
		imgFemal.setAlpha((float) 0.5);
		statue = 1;
	}

	/*
	 * 女
	 */
	private void doFemalJob() {
		imgFemal.setAlpha((float) 1);
		imgMals.setAlpha((float) 0.5);
		statue = 2;
	}

	/**
	 * 1:男 2：女
	 * 
	 * @return
	 */
	public int getStatue() {
		return statue;

	}
}
